package org.dromara.assets.domain;

import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.dromara.assets.config.TradePlanStatusEnum;

import java.math.BigDecimal;
import java.time.LocalDateTime;

@Data
@NoArgsConstructor
@TableName("assets_trade_plan")
public class AssetsTradePlan {

    private Long id;


    private String symbol; // 交易对


    private Integer state = 1; // 默认状态1


    private Short tradeType; // 1:买入；2:卖出


    private BigDecimal triggerPrice;


    private BigDecimal currentPrice;


    private BigDecimal orderPrice;


    private Boolean isRedeemNeeded = false;


    private String redeemSymbol;


    private Boolean isSwapNeeded = false;


    private String swapSymbol;


    private String orderId;


    private String transactionStatus;


    private LocalDateTime createdAt = LocalDateTime.now();

    private LocalDateTime updatedAt = LocalDateTime.now();

    private LocalDateTime alertSentAt;

    private LocalDateTime notifySentAt;

    private String remarks;

    // 辅助方法：根据状态枚举获取状态值
    public void setStateByEnum(TradePlanStatusEnum state) {
        this.state = state.getValue();
    }

    public TradePlanStatusEnum getStateEnum() {
        return TradePlanStatusEnum.fromValue(this.state);
    }
}